#include <fstream>
#include <string>

#include "big_int_t.h"

int main()
{
   std::ifstream input("in.txt");
   std::ofstream output("out.txt");

   big_int_t a, b;

   while (input >> a >> b)
   {
      if (b == big_int_t(0))
      {
         output << "<error>\n\n\n";
         continue;
      }
      std::pair<big_int_t, big_int_t> c = a.divide_with_remainder(b);
      output << c.first << "\n" << c.second << "\n\n";
   }

   return 0;
}